package com.itic.system.project.express.service;

import com.itic.appbase.framework.common.constants.DBConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.itic.appbase.framework.common.service.CrudService;
import com.itic.system.project.express.persistence.dao.ProjectExpressDao;
import com.itic.system.project.express.persistence.model.ProjectExpress;
import com.itic.system.project.express.persistence.model.ProjectExpressExample;
import com.itic.system.project.express.persistence.model.ProjectExpressExample.Criteria;

import java.util.List;


@Service
@Transactional
public class ProjectExpressService
     extends CrudService<ProjectExpressDao,ProjectExpress,ProjectExpressExample> {
    @Autowired
    private ProjectExpressDao projectExpressDao;

    /**
     * 查询所有的物流公司
     * @return
     */
    public List<ProjectExpress> findAllProjectExpress(){
        ProjectExpressExample example = new ProjectExpressExample();
        Criteria criteria = example.createCriteria();
        criteria.andIsEffectiveEqualTo(DBConst.TRUE);
        return this.list(example);
    }

    /**
     * 根据code查询物流公司
     * @param expressCode
     * @return
     */
    public ProjectExpress getProjectExpressByCode(String expressCode){
        ProjectExpress projectExpress = this.projectExpressDao.getProjectExpressByCode(expressCode);
        return projectExpress;
    }
}